---
--类名: AchievementController.lua
--创建日期: 2018-4-3
--创建人: 宋建邦
--功能描述: 成就控制器
--修改内容:


local AchView = import(".views.AchView")
-- local MedalWear = import("..views.MedalWear")
-- local AchReward = import("..views.AchReward")

local AchievementController = class("AchievementController",function()
	return display.newNode()
end)

function AchievementController:ctor(achType,labelType)
	self.mAchView = AchView.new(achType,labelType)
	self:addChild(self.mAchView)

	self.mAchView:show()

	self:addListeners()

	self:setNodeEventEnabled(true)
end

function AchievementController:selectTab(aTab, itemType, itemId)
	self.mAchView:selectTab(aTab,itemType, itemId)
end

function AchievementController:addListeners()
	self.mAchView:addEventListener("ACH_UI_CLOSE", handler(self, AchievementController.closeUI)) 
	-- self.mAchView:addEventListener("ACH_TAKE_AWARD", handler(self, Achcontroller.takeAchievementAward)) 
	-- self.mAchView:addEventListener("ACH_REFRESH_TJ", handler(self, Achcontroller.refreshTongji)) 
	-- self.mAchView:addEventListener("ACH_OPEN_MEDAL", handler(self, Achcontroller.openMedal)) 
	-- self.badgeHandler = UD.badge:onChanged(function(id,num)
    -- 	self.mAchView:refreshNewPoint()
    -- end)
end

function AchievementController:onEnter()

end

function AchievementController:onExit()
	-- UD.badge:unChanged(self.badgeHandler)
end

function AchievementController:closeUI()
	UIHandler:handleMessage({id = Constant.FUNC_TYPE_CJ,mode = "close"})
end

function AchievementController:getViewType()
	return app.mvc.VIEWTYPE_BLUR
end

return AchievementController